//选择时间区间
	$(".TimeInterval .mode").click(function() {
		if (!$(this).hasClass("active")) {
			$(".TimeInterval .mode").removeClass("active");
			$(this).addClass("active");
			if($(this).text()=="最近7天（含今日）"){
				FoundListData("week");
				LoadHeightchartData("week");
			}else if($(this).text()=="最近15天（含今日）"){
				FoundListData("half_month");
				LoadHeightchartData("half_month");
			}else if($(this).text()=="最近30天（含今日）"){
				FoundListData("month");
				LoadHeightchartData("month");
			}
			var ListData=ReturnData;
			ReturnData="";
			//console.log(ListData);
			$(".newPeople .addUser").text(ListData.addUser);
			$(".newPeople .bindCardUser").text(ListData.bindCardUser);
			$(".newPeople .cancelUser").text(ListData.cancelUser);
		}
	});

//初始化列表数据
initList();
var ReturnData;//统计返回的数据
function initList(){
	FoundListData("week");
	var ListData=ReturnData;
	ReturnData="";
	//console.log(ListData);
	$(".newPeople .addUser").text(ListData.addUser);
	$(".newPeople .bindCardUser").text(ListData.bindCardUser);
	$(".newPeople .cancelUser").text(ListData.cancelUser);

	
	FoundListData();
	var ListData=ReturnData;
	ReturnData="";
	$(".totalPeople .addUser").text(ListData.addUser);
	$(".totalPeople .bindCardUser").text(ListData.bindCardUser);
	$(".totalPeople .cancelUser").text(ListData.cancelUser);
}
function FoundListData(countRange){
var formObject={"countRange":countRange}		
$.ajax({
			type:"POST",
			url:DataURL+"bank/user/countUser",
			dataType:'json', 
			async : false,
			contentType :"application/json;charset=UTF-8",
			data: JSON.stringify(formObject),//传递给服务器的参数
			//data: {"countRange":"week"},
			success:function(data){
				if(checkTokenError(data)){
				//console.log(data);
				ReturnData=data.content;
				}
			},
	        error:function(data){
	            //console.log(data)
	            zxTips_short({
	    			txt : "系统错误"
	    			});
	        }
		});
}


	//获取统计图数据
	var HeightchartsData;
	LoadHeightchartData("week");
	function LoadHeightchartData(countRange){
		$.ajax({
			type:"POST",
			url:DataURL+"bank/user/day",
			dataType:'json', 
			async : false,
			contentType :"application/json;charset=UTF-8",
			data: JSON.stringify({"countRange":countRange}),//传递给服务器的参数
			//data: {"countRange":"week"},
			success:function(data){
				if(checkTokenError(data)){
				//console.log(data);
				HeightchartsData=data.content;
				//console.log(HeightchartsData);
				BuildHighCharts();
				}
			},
	        error:function(data){
	            zxTips_short({
	    			txt : "系统错误"
	    			});
	        }
		});
	}

	var chart
	function BuildHighCharts(){
		chart  = new Highcharts.Chart('container', {
			 title: {
			        text: '',
			    },
			    xAxis: {
			        categories: HeightchartsData.date
			    },
			    yAxis: {
			        title: {
			            text: '人数'
			        },
			        plotLines: [{
			            value: 0,
			            width: 1,
			            color: '#808080'
			        }]
			    },
			    tooltip: {
			        valueSuffix: '人'
			    },
		        credits:{enabled : false,},
			    colors: ['#f76565', '#36ca78', '#a56ffe'],
			    legend: {
			        layout: 'vertical',
			        align: 'left',
			        verticalAlign: 'top',
			        borderWidth: 0,
			    },
			    series: [{
			        name: '新增关注人数',
			        data: HeightchartsData.newUser
			    }, {
			        name: '新增绑卡人数',
			        data: HeightchartsData.bindCard
			    }, {
			        name: '取消关注人数',
			        data: HeightchartsData.cancleUser
			    }]
		 });
	}
